#include <algorithm>
#include <iostream>
#include <vector>
// 爬楼梯最小惩罚问题
int minCostClimbingStairs(int n, std::vector<int> costs) {
  int a = 1;
  int b = 2;
  int a_minCost = costs[a];
  int b_minCost = std::min(costs[a] + costs[a], costs[b]);
  if (n == 1) {
    return a_minCost;
  }
  if (n == 2) {
    return b_minCost;
  }

  for (int i = 3; i <= n; i++) {
    int t = b_minCost;
    b_minCost = std::min(costs[i] + a_minCost, costs[i] + b_minCost);
    a_minCost = t;
  }
  return b_minCost;
}

int main() {
  std::vector<int> costs{0, 1, 10, 1, 2};
  int minCost = minCostClimbingStairs(4, costs);
  std::cout << minCost << std::endl;
}